﻿//-----------------------------------------------------------------------
// <copyright file="RepositoryFactory.cs" company="FastNET Services">
//     Copyright (c) 2008-2009. All Rights Reserved.
// </copyright>
// <license>
//     GPLv2
// </license>
// <warranty>
//     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
//     BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
//     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
//     DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// </warranty>
//-----------------------------------------------------------------------
#region Usings

using GateShift.Common.Repository.Interfaces.Factories;
using GateShift.Common.Repository.Interfaces.Repositories.Base;
using GateShift.Services.GameData;

#endregion

namespace GateShift.Services.GameFramework
{
    /// <summary>
    /// Factory for selecting the underlying data source for business objects
    /// </summary>
    public class RepositoryFactory : IRepositoryFactory
    {
        //// TODO: This is where we add the additional providers of data

        private static readonly SQLDataProvider _provider;

        /// <summary>
        /// Initializes static members of the RepositoryFactory class
        /// </summary>
        static RepositoryFactory()
        {
            _provider = new SQLDataProvider();
        }

        /// <summary>
        /// Gets the specified instance of Repository Type
        /// </summary>
        /// <typeparam name="T">IRepository type to get</typeparam>
        /// <returns>Instance of IRepository</returns>
        public T GetRepository<T>() where T : class, IRepository
        {
            return _provider.GetRepository<T>();
        }
    }
}